﻿@page "/AiModels/Add"
@page "/AiModels/{aiModelId:int}/Edit"
@using maERP.SharedUI.Services.Base
@using Microsoft.AspNetCore.Authorization

@attribute [Authorize]

<MudText Typo="Typo.h4" Class="mb-8">AI Modell bearbeiten</MudText>

<MudForm Model="@aiModel" @ref="@_form">
    <MudGrid>
        <MudItem xs="6">
            <MudSelect T="AiModelType" Label="Typ" HelperText="Model-Typ" Placeholder="Typ auswählen" @bind-Value="@aiModel.AiModelType" Class="mt-6">
                <MudSelectItem Value="AiModelType._100">ChatGPT 4o</MudSelectItem>
                <MudSelectItem Value="AiModelType._200">Claude Opus 3.5</MudSelectItem>
            </MudSelect>
            
            <MudTextField @bind-Value="aiModel.Name"
                          For="@(() => aiModel.Name)"
                          Label="Modellname"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6"/>

            <MudTextField @bind-Value="aiModel.ApiUsername"
                          For="@(() => aiModel.ApiUsername)"
                          Label="API Username"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6"/>

            <MudTextField @bind-Value="aiModel.ApiPassword"
                          For="@(() => aiModel.ApiPassword)"
                          Label="API Passwort"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6"/>

            <MudTextField @bind-Value="aiModel.ApiKey"
                          For="@(() => aiModel.ApiKey)"
                          Label="API Key"
                          Required="true"
                          Variant="Variant.Text"
                          InputType="InputType.Text"
                          Class="mt-6"/>

            <MudButton Variant="Variant.Filled"
                       Color="Color.Primary"
                       Size="Size.Large"
                       ButtonType="ButtonType.Button"
                       OnClick="@(Save)"
                       Class="mt-6">Speichern</MudButton>
        </MudItem>
    </MudGrid>
</MudForm>